﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Proxies;
using System.Text;

namespace Janus.Cores.RealProxy
{
    [AttributeUsage(AttributeTargets.Class)]
    public class IdalProxyAttribute : ProxyAttribute
    {
        public override MarshalByRefObject CreateInstance(Type serverType)
        {
            MarshalByRefObject target = base.CreateInstance(serverType);
            IdalProxy rp = new IdalProxy(target, serverType);
            MarshalByRefObject obj = (MarshalByRefObject)rp.GetTransparentProxy();
            return obj;
        }

        public object GetServices(Type serverType)
        {
            MarshalByRefObject target = base.CreateInstance(serverType);
            IdalProxy rp = new IdalProxy(target, serverType);
            return rp.GetTransparentProxy();
        }
    }
}
